
$(function(){
	 $("#login_bg").load("register.html?_="+Math.random(),function(){
	 	$("#re_form").hide()
	 })
/*	var name = getCookie("username");
	var pd = getCookie("password");*/
	user = getCookie("user")
	console.log(user)
	user = JSON.parse(user)
	
	$("#login_submit").click(function(){
		if(user){
		console.log(user.data[0].username)
			for(i=0;i<user.data.length;i++){
				if($("#login_username").val() == user.data[i].username && $("#login_password").val() == user.data[i].password){
					$(".hint span").show().css("color","purple").html("欢迎登陆飞虎乐购").next().hide();
					
					//记录当前登录账号
					var d = new Date();
						d.setDate(d.getDate()+10);
						var	obj = $("#login_username").val()		
					setCookie("cur_user",obj,d)
					
					window.location.href = "index.html";
					/*$(".bigbody").load("index.html?_="+Math.random(),function(){
						$("#nav #user").html("...")
					})*/
					break;
				}else{
					$(".hint span").hide().next().show();
				}
			}
		}else{
			alert("您好没有注册，请先进行注册")
		}
	})
})
   
//$("#main_head").load("head.html?_="+Math.random())